<html>
<head><meta charset="utf-8"><title>API stability of error types · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html">API stability of error types</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210677589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210677589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210677589">(Sep 20 2020 at 18:00)</a>:</h4>
<p>it feels like api stability is probably something we will want to explore as a group and document all the options and their tradeoffs</p>



<a name="210677653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210677653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210677653">(Sep 20 2020 at 18:01)</a>:</h4>
<p>my view is that between non exhaustive enums and opaque enums neither is "correct"</p>



<a name="210677691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210677691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210677691">(Sep 20 2020 at 18:02)</a>:</h4>
<p>all the options have their tradeoffs and are valid and the correct one to use depends on your needs</p>



<a name="210678068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210678068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210678068">(Sep 20 2020 at 18:10)</a>:</h4>
<p>I wholeheartedly agree. If nothing else, I'd like to <em>raise awareness</em> that error types are a part of the crates public API. I think it's far too easy to think of them as second-class things and not pay attention to that aspect of them.</p>



<a name="210679391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210679391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Seán Kelleher <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210679391">(Sep 20 2020 at 18:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types/near/210677653">said</a>:</p>
<blockquote>
<p>my view is that between non exhaustive enums and opaque enums neither is "correct"</p>
</blockquote>
<p>What are these error types?</p>



<a name="210679400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210679400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210679400">(Sep 20 2020 at 18:44)</a>:</h4>
<p><span class="user-mention" data-user-id="344273">@Seán Kelleher</span> I don't understand the question</p>



<a name="210679511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210679511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Seán Kelleher <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210679511">(Sep 20 2020 at 18:46)</a>:</h4>
<p>Sorry, I just didn't understand the terms; are these approaches for error handling?</p>



<a name="210679585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210679585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Seán Kelleher <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210679585">(Sep 20 2020 at 18:48)</a>:</h4>
<p>Also, I agree with the premise of supporting different approaches to error handling; I think exhaustive error handling should be possible ideally but should be opt-in, as it might not be necessary or even desirable for a given project.</p>



<a name="210679609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210679609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210679609">(Sep 20 2020 at 18:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="344273">Seán Kelleher</span> <a href="#narrow/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types/near/210679511">said</a>:</p>
<blockquote>
<p>Sorry, I just didn't understand the terms; are these approaches for error handling?</p>
</blockquote>
<p>It's not fully clear to me either, the developer documentation covering opaque<br>
types is less than clear (no pun intended). I believe non-exhaustive refers to<br>
cases where a <code>match</code> is allowed to omit one or more enum variants.</p>



<a name="210680245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680245">(Sep 20 2020 at 19:05)</a>:</h4>
<p>they're both approaches to structuring errors to allow later changes in backwards compatible ways</p>



<a name="210680313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680313">(Sep 20 2020 at 19:07)</a>:</h4>
<p>for non exhaustive you use the #[non_exhaustive] annotation on your type definition and variants to prevent downstream users from matching on them exhaustively or constructing them</p>



<a name="210680332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680332">(Sep 20 2020 at 19:07)</a>:</h4>
<p>in the opaque type case you hide the inner values and have a kind enum usually within a struct or something and then you expose some methods for reacting to specific error kinds</p>



<a name="210680339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680339">(Sep 20 2020 at 19:07)</a>:</h4>
<p>such as a kind function or maybe a PartialEq implementation or w.e</p>



<a name="210680378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680378">(Sep 20 2020 at 19:08)</a>:</h4>
<p>there's a lot of ways to do the opaque error type approach</p>



<a name="210680390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680390">(Sep 20 2020 at 19:08)</a>:</h4>
<p>I personally tend to prefer non exhaustive enums but I'll use opaque errors in cases where I want to hide internals</p>



<a name="210680397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680397">(Sep 20 2020 at 19:08)</a>:</h4>
<p>or when I want to have members that are shared between every error kind without repeating myself a ton</p>



<a name="210680412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680412">(Sep 20 2020 at 19:09)</a>:</h4>
<p>I bet you could also do some sort of associated consts thing like how tracing manages their LEVEL enum</p>



<a name="210680424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680424">(Sep 20 2020 at 19:09)</a>:</h4>
<p>never seen someone do that for errors tho</p>



<a name="210680611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680611">(Sep 20 2020 at 19:14)</a>:</h4>
<p>Is "opaque error" a term that other people use? I only know of it from <a href="https://docs.rs/snafu/0.6.8/snafu/guide/opaque/index.html">my usage in SNAFU</a>.</p>



<a name="210680788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680788">(Sep 20 2020 at 19:18)</a>:</h4>
<p>Stating the problem with code:</p>
<div class="codehilite"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">enum</span> <span class="nc">Error</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">CaseOne</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">CaseTwo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">source</span>: <span class="nc">other_crate</span>::<span class="n">SomeError</span><span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>With this semi-common definition, the library exposing <code>Error</code> can't:</p>
<ul>
<li>Add a variant</li>
<li>Remove a variant</li>
<li>Add fields to a variant</li>
<li>Remove fields from a variant</li>
<li>Change the type of a field in a variant</li>
<li>Change the name of a field in a variant</li>
<li>Change a variant from tuple-like to struct-like or vice-versa</li>
<li>Upgrade the <code>other_crate</code> to a semver-incompatible version</li>
</ul>
<p>without breaking its own semver</p>



<a name="210680855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680855">(Sep 20 2020 at 19:20)</a>:</h4>
<p>You can add <a href="https://doc.rust-lang.org/reference/attributes/type_system.html"><code>#[non_exhaustive]</code></a> to the enum and each variant to address some but not all of those cases.</p>



<a name="210680860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680860">(Sep 20 2020 at 19:20)</a>:</h4>
<p>specifically, adding that attribute allows you to </p>
<ul>
<li>Add a variant</li>
<li>Add fields to a variant</li>
</ul>
<p>without breaking semver</p>



<a name="210680916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680916">(Sep 20 2020 at 19:22)</a>:</h4>
<p>That's because <code>#[non_exhaustive]</code> effectively adds a "fake" variant / field that is private and cannot be matched on.</p>



<a name="210680949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210680949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210680949">(Sep 20 2020 at 19:23)</a>:</h4>
<p>Private to the downstream crates?</p>



<a name="210681013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210681013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210681013">(Sep 20 2020 at 19:25)</a>:</h4>
<p>So upstream can't match on it explicitly but downstream extends it locally and this is enabled through non-exhaustive generic <code>match</code>logic in the upstream code</p>



<a name="210681169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210681169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210681169">(Sep 20 2020 at 19:28)</a>:</h4>
<p>I feel like opaque type is a pretty common term in rust even outside of error handling but that might just be me</p>



<a name="210681590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210681590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210681590">(Sep 20 2020 at 19:38)</a>:</h4>
<p><span class="user-mention" data-user-id="281739">@oliver</span> I feel like you are using "upstream" and "downstream" differently than I expect, as well as "private <strong>to</strong>".</p>
<p>The crate that exposes the <code>Error</code> enum effectively has private variants / fields thanks to <code>non_exhaustive</code>. This prevents a consumer of the crate from matching on those without including a catch-all pattern (<code>..</code>). That's what allows adding new variants / fields.</p>



<a name="210681943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210681943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jason Smith <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210681943">(Sep 20 2020 at 19:47)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/opaque-types-type-alias-impl-trait.html">https://rustc-dev-guide.rust-lang.org/opaque-types-type-alias-impl-trait.html</a></p>
<p>Opaque Type is indeed a thing in Rust. Is this what you are referring to, or are you using the term in a more generic "the inner part of my struct is all private" manner?</p>



<a name="210682444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682444">(Sep 20 2020 at 19:58)</a>:</h4>
<p>ooh, I'm referring to the latter</p>



<a name="210682446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682446">(Sep 20 2020 at 19:58)</a>:</h4>
<p>not existential types</p>



<a name="210682453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682453">(Sep 20 2020 at 19:59)</a>:</h4>
<p>I’m (trying) to only say “opaque error”, related to but different from “opaque type”. My meaning is inner value/type is private.</p>



<a name="210682518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682518">(Sep 20 2020 at 20:01)</a>:</h4>
<p>Although I mentioned in another topic that <code>impl Error</code> is a possibility, but not I’ve ever seen.</p>



<a name="210682528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682528">(Sep 20 2020 at 20:01)</a>:</h4>
<p>I made a crate to work with impl errors but I never tried popularizing It because of probably obvious reasons</p>



<a name="210682531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682531">(Sep 20 2020 at 20:01)</a>:</h4>
<p>but check it out</p>



<a name="210682536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682536">(Sep 20 2020 at 20:01)</a>:</h4>
<p>Mostly because I think it would involve generics in a way that are uncommon.</p>



<a name="210682546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682546">(Sep 20 2020 at 20:02)</a>:</h4>
<p><a href="https://docs.rs/adhocerr/0.1.2/adhocerr/">https://docs.rs/adhocerr/0.1.2/adhocerr/</a></p>



<a name="210682598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682598">(Sep 20 2020 at 20:02)</a>:</h4>
<p>slightly off topic</p>



<a name="210682613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682613">(Sep 20 2020 at 20:03)</a>:</h4>
<p>back to opaque errors, Id be fine with standardizing on that terminology but we should definitely keep an eye on it to see if it's causing too much confusion with existential types</p>



<a name="210682642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682642">(Sep 20 2020 at 20:04)</a>:</h4>
<p>standardizing on that within discussions in the project group and in our writings* that is</p>



<a name="210682670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682670">(Sep 20 2020 at 20:04)</a>:</h4>
<p>I wasn’t even trying to popularize that specific term (and was surprised other people used it) 😲</p>



<a name="210682745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> must-compute <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682745">(Sep 20 2020 at 20:06)</a>:</h4>
<p>It might help avoid confusion to discuss this concept (in our writings) as "Public Error API" vs "private error fields"</p>



<a name="210682781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210682781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> must-compute <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210682781">(Sep 20 2020 at 20:07)</a>:</h4>
<p>since the main concern is <code>semver</code> breakage, from what I understand above.</p>



<a name="210683120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210683120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> must-compute <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210683120">(Sep 20 2020 at 20:14)</a>:</h4>
<p>actually nvm what I'm suggesting might also cause confusion</p>



<a name="210684215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684215">(Sep 20 2020 at 20:37)</a>:</h4>
<p>I wonder if it would be possible to add a feature to make the contents of an enum less exposed</p>



<a name="210684264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684264">(Sep 20 2020 at 20:38)</a>:</h4>
<p>I'm assuming there isn't but I don't know the history behind the decision to make enums pub by default</p>



<a name="210684274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684274">(Sep 20 2020 at 20:38)</a>:</h4>
<p>another thing that I think would be useful in the context of error handling is private trait impls</p>



<a name="210684275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684275">(Sep 20 2020 at 20:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types/near/210684264">said</a>:</p>
<blockquote>
<p>I'm assuming there isn't but I don't know the history behind the decision to make enums pub by default</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/8122">https://github.com/rust-lang/rust/issues/8122</a> has some context</p>



<a name="210684372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684372">(Sep 20 2020 at 20:41)</a>:</h4>
<p>Aren't there issues with fat-pointers to objects with hidden properties?</p>



<a name="210684388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684388">(Sep 20 2020 at 20:41)</a>:</h4>
<p>This starts to look like a FFI to me</p>



<a name="210684448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684448">(Sep 20 2020 at 20:42)</a>:</h4>
<p>looks like the logic was if you need a private enum you can just wrap it in a struct and it's better to have fewer keywords</p>



<a name="210684486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684486">(Sep 20 2020 at 20:44)</a>:</h4>
<p>Mmmmmm private trait impls.</p>



<a name="210684530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684530">(Sep 20 2020 at 20:44)</a>:</h4>
<blockquote>
<p>Aren't there issues with fat-pointers to objects with hidden properties?</p>
</blockquote>
<p>not sure, I didn't imagine you'd still be able to make trait objects to it, the reason I want it is so you can have from impls for external types on your error type without exposing that in your api</p>



<a name="210684556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684556">(Sep 20 2020 at 20:44)</a>:</h4>
<p>but I could see how that could cause issue if someone tried to turn it into a dyn From and return it from their API</p>



<a name="210684653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210684653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210684653">(Sep 20 2020 at 20:47)</a>:</h4>
<p>I imagined that's ~how it would function.</p>



<a name="210691332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210691332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210691332">(Sep 20 2020 at 23:51)</a>:</h4>
<p>There are also anonymous enum types</p>



<a name="210691371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210691371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210691371">(Sep 20 2020 at 23:52)</a>:</h4>
<p><a href="https://internals.rust-lang.org/t/ideas-around-anonymous-enum-types/12627">https://internals.rust-lang.org/t/ideas-around-anonymous-enum-types/12627</a></p>



<a name="210691381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210691381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210691381">(Sep 20 2020 at 23:53)</a>:</h4>
<p>Maybe off topic here as well not sure</p>



<a name="210691440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210691440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210691440">(Sep 20 2020 at 23:55)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281739">oliver</span> <a href="#narrow/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types/near/210691332">said</a>:</p>
<blockquote>
<p>There are also anonymous enum types</p>
</blockquote>
<p>That's effectively a large part of the discussion in <a class="stream-topic" data-stream-id="257204" href="/#narrow/stream/257204-project-error-handling/topic/Better.20enums">#project-error-handling &gt; Better enums</a></p>



<a name="210757065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210757065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210757065">(Sep 21 2020 at 15:23)</a>:</h4>
<p>Well that's a 210 comment thread.. I'm going to need to a tl;dr summary. What<br>
else could have parenthesis added for the group? A survey of what we are calling<br>
<code>opaque errors</code> as distinct from <code>opaque types</code>? Do projects often accumulate<br>
shared notes and references?</p>



<a name="210767839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210767839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210767839">(Sep 21 2020 at 16:45)</a>:</h4>
<blockquote>
<p>Well that's a 210 comment thread.. I'm going to need to a tl;dr summary.</p>
</blockquote>
<p>There is a discussion about how best to define errors and what improvements can be made, and a lot  of the early discussion in the thread centered around anon enums but that discussion didn't get super far because there are a lot of unresolved questions about stuff such as how do you unify the enums, name the types, etc</p>



<a name="210767881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210767881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210767881">(Sep 21 2020 at 16:45)</a>:</h4>
<blockquote>
<p>What else could have parenthesis added for the group? A survey of what we are calling<br>
opaque errors as distinct from opaque types?</p>
</blockquote>



<a name="210767890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210767890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210767890">(Sep 21 2020 at 16:45)</a>:</h4>
<p>I don't understand this question</p>



<a name="210768151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210768151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210768151">(Sep 21 2020 at 16:47)</a>:</h4>
<blockquote>
<p>Do projects often accumulate shared notes and references?</p>
</blockquote>
<p>I don't know but I think it would be a good idea for the error handling project group even if there isn't any precedent for creating shared notes and references if only because I expect a large amount of our work is going to be producing learning materials.</p>



<a name="210779509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/API%20stability%20of%20error%20types/near/210779509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/API.20stability.20of.20error.20types.html#210779509">(Sep 21 2020 at 18:14)</a>:</h4>
<p>I'll share my notes on that forum thread when finished.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>